Interprets the terminal events we care about:
- Resize events.
- Keyboard input.
Resize events are handled by registering a signal handler for SIGWINCH.
Keyboard events are read from stdin. We look for byte strings of key combinations that we care about. E.g. Alt-arrow keys, C-w etc.